CREATE PROCEDURE sp_Example
AS
BEGIN
    SET NOCOUNT ON;
    SET XACT_ABORT ON;  -- 自动回滚事务（错误时）
    BEGIN TRANSACTION;
    BEGIN TRY
        -- 业务逻辑（如多表操作）
        UPDATE Table1 SET Column1 = Value1 WHERE ID = 1;
        INSERT INTO Table2 (Column2) VALUES ('Data');
        COMMIT TRANSACTION;
    END TRY
    BEGIN CATCH
        ROLLBACK TRANSACTION;
        THROW;  -- 抛出错误信息‌:ml-citation{ref="2,3" data="citationList"}
    END CATCH;
END;
